home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Libraries / TurboTCP 2.0.1 / TurboTCP source / CTCPAsyncCall.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-21  |  2.2 KB  |  98 lines  |  [TEXT/MPCC]

  1. /*
  2. ** CTCPAsyncCall.h
  3. **
  4. **    TurboTCP support library
  5. **    TCP asynchronous call class
  6. **
  7. **    Copyright © 1993-94, FrostByte Design / Eric Scouten
  8. **
  9. */
  10.  
  11. #pragma once
  12.  
  13. #include "TCL.h"
  14.  
  15. #include <Types.h>                            // get <ConditionalMacros.h> if available
  16. #if (defined(GENERATINGPOWERPC) || defined(GENERATING68K))
  17. #include <MacTCP.h>                            // Universal Headers 2.0
  18. #else
  19. #include <TCPPB.h>                            // Univ Headers 1.0 or old headers
  20. #define GENERATINGCFM USESROUTINEDESCRIPTORS
  21. #endif
  22.  
  23. #include "CTCPDriver.h"
  24. #include "TCPCompletionProc.h"
  25.  
  26. class CTCPStream;
  27.  
  28.  
  29. /*______________________________________________________________________
  30. **
  31. ** CTCPAsyncCall
  32. **
  33. **    This object encapsulates each asynchronous call to MacTCP. This method is used so that
  34. **    the call’s I/O block may persist beyond the scope of the method call which originates the
  35. **    call (these methods are located in CTCPStream).
  36. **
  37. **    NOTE: All interaction with CTCPAsyncCalls should be through CTCPStream. No other class
  38. **    should have a reason to use this object, nor should this object be subclassed. Accordingly,
  39. **    all members of this class are declared private.
  40. **
  41. */
  42.  
  43. #if defined(powerc) || defined (__powerc)
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47. class CTCPAsyncCall {
  48.  
  49.     friend class CTCPStream;
  50.     friend class CTCPDriver;
  51.  
  52.     TCL_DECLARE_CLASS;
  53.  
  54. private:
  55.     CTCPStream&        itsStream;            // the stream that requested this call
  56.     TurboTCPiopb        itsiopb;                // the TCP parm block, plus a few things (see "TCPCompletionProc.h")
  57.  
  58. #if GENERATINGCFM
  59.     static UniversalProcPtr completionProcUPP;    // UPP for asynchronous completion proc
  60. #endif
  61.     
  62.  
  63.     // constructor
  64.     
  65.                     CTCPAsyncCall(CTCPStream& theStream)
  66.                         : itsStream(theStream)
  67.                         {
  68.                             itsiopb.itsQElem.qType = asyncCall;
  69.                             itsiopb.itsQElem.qSelfLink = this;
  70.                         }
  71.  
  72.  
  73.     // initiate, process TCP call
  74.  
  75.     OSErr            DoAsyncCall(short theCsCode, TCPiopb* theParamBlockPtr);
  76.     OSErr            DoAsyncCall(short theCsCode);
  77.     
  78.     void                ProcessCompletion();
  79.     Boolean            Dispatch();
  80.     Boolean            DispatchNoCopyRcv();
  81.  
  82.  
  83.     // completion procedure
  84.         
  85.     static void        GetCompletionProc();
  86.  
  87. #ifndef TCL_POWER_PC
  88.     static pascal void    CompletionProc();
  89. #else
  90.     static pascal void    CompletionProc(struct TurboTCPiopb* iopb);
  91. #endif
  92.  
  93. };
  94.  
  95. #if defined(powerc) || defined (__powerc)
  96. #pragma options align=reset
  97. #endif
  98.